<template>
    <div>
        <el-card>
            <el-row style="padding-top: 15px;">
                <el-row>
                    <el-col :span="4">
                        <p style="font-size: larger; font-weight: bolder;">{{ studentName }}</p>
                    </el-col>
                    <el-col :span="2" :offset="16">
                        <el-button type="success" el-icon-plus size="mini" @click="dialogFormVisible = true">
                            添加线索</el-button>
                    </el-col>
                    <el-col :span="1">
                        <el-button type="primary" el-icon-plus size="mini" @click="update()">
                            编辑学员</el-button>
                    </el-col>
                    <el-row style="margin-top: 7%;">
                        <el-col :span="5">
                            <span style="font-size:smaller">家长姓名：{{ parentsName }}</span>
                        </el-col>
                        <el-col :span="5">
                            <span style="font-size:smaller">出生日期：{{ birthdate }}</span>
                        </el-col>
                        <el-col :span="5">
                            <span style="font-size:smaller">跟踪状态：{{ state }}</span>
                        </el-col>
                    </el-row>
                    <el-row style="margin-top: 2%;">
                        <el-col :span="5">
                            <span style="font-size:smaller">所属关系：{{ ownership }}</span>
                        </el-col>
                        <el-col :span="5">
                            <span style="font-size:smaller">联系电话：{{ cellphone }}</span>
                        </el-col>
                        <el-col :span="5">
                            <span style="font-size:smaller">意向程度：{{ leveling }}</span>
                        </el-col>
                    </el-row>
                    <el-row style="margin-top: 2%;">
                        <el-col :span="5">
                            <span style="font-size:smaller">咨询校区：{{ campus }}</span>
                        </el-col>
                        <el-col :span="5">
                            <span style="font-size:smaller">录入时间：{{ createTime }}</span>
                        </el-col>
                        <el-col :span="5">
                            <span style="font-size:smaller">录入人：{{ teacher }}</span>
                        </el-col>
                    </el-row>
                </el-row>
            </el-row>
        </el-card>
        <el-card style="margin-top: 2%;">
            <el-table :data="tableData" stripe style="margin-top: 20px;" border>
                <el-table-column prop="id" label="序号">
                </el-table-column>
                <el-table-column prop="clue" label="线索">
                </el-table-column>
                <el-table-column prop="createTime" label="时间">
                </el-table-column>
            </el-table>
        </el-card>

        <el-dialog title="添加线索" :visible.sync="dialogFormVisible">
            <el-row>
                <span>线索：</span>
                <el-input style="width: 600px ;margin-right: 0%;" v-model="clue" size="small">         
                </el-input>
            </el-row>
            <div slot="footer" class="dialog-footer">
                <el-button @click="dialogFormVisible = false">取 消</el-button>
                <el-button type="primary" @click="addClue()">确 定</el-button>
            </div>
        </el-dialog>
    </div>
</template>

<script>
export default {
    data() {
        return {
            id: this.$route.params.id,
            studentName: '',
            birthdate: '',
            cellphone: '',
            campus: '',
            teacher: '',
            ownership: '',
            sourceId: '',
            state: '',
            leveling: '',
            parentsName: '',
            createTime: '',
            delTime: '',
            tableData: [],
            clue:'',
            dialogFormVisible : false
        };
    },
    methods: {
        addClue:function(){
            let data={
                clue:this.clue,
                psId:this.id
            }
            this.$axios.post("/prospectiveStudent/insertClue",data).then(res =>{
                console.log(res.data);
                this.$message.success("添加成功")
                this.dialogFormVisible = false
                this.clue = ''
                this.show()
            })
        },
        //修改
        update: function () {
            this.$router.push("/psUpdate/" + this.id)
        },
        show:function(){
            this.$axios.post("/prospectiveStudent/findByCluePage/" + this.id).then(res => {
            console.log(res.data)
            this.tableData = res.data.data
        })
        }

    },
    mounted() {
        console.log(this.id);
        this.$axios.post("/prospectiveStudent/findByCid/" + this.id).then(res => {
            console.log(res.data)
            //  this.gridData = res.data.data
            this.studentName = res.data.data.studentName
            this.parentsName = res.data.data.parentsName
            this.birthdate = res.data.data.birthdate
            this.state = res.data.data.state
            this.ownership = res.data.data.ownership
            this.cellphone = res.data.data.cellphone
            this.leveling = res.data.data.leveling
            this.campus = res.data.data.campus
            this.createTime = res.data.data.createTime
            this.teacher = res.data.data.teacher
        })
        this.show()
        
    },
};
</script>



<style scoped></style>


<style scoped></style>